#!/bin/bash

echo "正在启动WebSearch MCP服务器..."
python -m websearch server --headless --extract-mode body &
SERVER_PID=$!

echo "等待MCP服务器启动..."
sleep 3

echo "启动MCP Inspector..."
npx -y @modelcontextprotocol/inspector &
INSPECTOR_PID=$!

echo "调试环境已准备就绪！"
echo "MCP服务器运行在 http://localhost:8000"
echo "Inspector已连接到服务器进行调试"
echo ""
echo "按 Ctrl+C 停止所有进程"

# 设置信号处理
trap "kill $SERVER_PID $INSPECTOR_PID; exit" INT TERM

# 等待用户中断
wait 